In a packet communication network, routers receive packets through one of a set of input interfaces and forward them on through one of a set of output interfaces. Routing decisions are made on the basis of information in the packet header, which typically includes the destination address and source address of the packet, along with other information, such as the destination and source device ports, transport protocol, packet length, and priority. The form and contents of the packet header and the manner in which routing decision are made based on the packet header are specified by the network-layer protocol that is used in the network. The most common network-layer protocol is the Internet Protocol (IP), and in particular IP Version 4 (IPv4).
The IPv4 packet format is defined by Request for Comments (RFC) 791 of the Internet Engineering Task Force (IETF). In accordance with RFC 791, the IPv4 header comprises 14 fields, of which the first 13 are required, and the fourteenth is optional. The first 13 fields, referred to as the “basic header,” have a total length of 20 bytes, while the fourteenth field, referred to as “options,” can contain up to an additional 40 bytes. The Internet Header Length (IHL) field in the basic header indicates the total header length, which is limited to no more than 60 bytes.
Options in the IPv4 header (as well as in other protocols, such as the Transmission Control Protocol—TCP) are often encoded in a type-length-value (TLV) format. In this sort of format, each option is represented by a record that includes a type field indicating the type of information in the record; a length field indicating the size of the record (typically in bytes); and a value field containing the record data. Many different TLV records can be added as options to the same basic header, up to the total length constraint of 60 bytes. The order of the TLV records is arbitrary, so that a given TLV can be anywhere in the list of options.